package com.mac.intellect_flow.enums;

import lombok.Getter;

/**
 * 错误码对象
 *
 *
 */
@Getter
public enum ResultCodeEnum {

    SUCCESS(200, "成功"),

    // ========== 客户端错误段 ==========

    BAD_REQUEST(400, "请求参数不正确"),
    UNAUTHORIZED(401, "账号未登录"),
    FORBIDDEN(403, "没有该操作权限"),
    NOT_FOUND(404, "请求未找到"),
    METHOD_NOT_ALLOWED(405, "请求方法不正确"),
    LOGIN_ERROR(406, "用户名或密码错误"),
    LOCKED(423, "请求失败，请稍后重试"), // 并发请求，不允许
    TOO_MANY_REQUESTS(429, "请求过于频繁，请稍后重试"),

    // ========== 服务端错误段 ==========

    INTERNAL_SERVER_ERROR(500, "系统异常"),
    ID_EMPTY_ERROR(530, "参数ID不能为空"),
    NOT_EXISTS_ERROR(531, "数据查询不存在"),
    FILE_UPLOAD_ERROR(532, "文件上传错误"),
    FILE_DOWNLOAD_ERROR(533, "文件下载错误"),
    FILE_UPVIDEO_ERROR(534, "视频上传错误"),
    PARAM_EMPTY_ERROR(535, "参数不能为空"),
    LOGIN_EXPIRED(536,"登录已过期,请重新登陆"),
    FIELD_NOT_EXIST(537,"字段不存在"),
    FIELD_VAL_ERROR(538,"获取字段值错误"),
    TOKEN_EMPTY(539,"token为空"),



    // ========== 自定义错误段 ==========
    REPEATED_REQUESTS(900, "重复请求，请稍后重试"),


    UNKNOWN(999, "未知错误"),
    ;

    /**
     * 错误码
     */
    private final Integer code;
    /**
     * 错误提示
     */
    private final String msg;

    ResultCodeEnum(Integer code, String message) {
        this.code = code;
        this.msg = message;
    }

}
